package com.wuwei.elearning.question.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wuwei.elearning.question.domain.Question;
import com.wuwei.elearning.question.domain.QuestionTranslated;
import com.wuwei.elearning.question.mapper.QuestionItemMapper;
import com.wuwei.elearning.question.mapper.QuestionMapper;
import com.wuwei.elearning.question.mapper.QuestionTranslatedMapper;
import com.wuwei.elearning.question.service.QuestionService;
import com.wuwei.elearning.question.service.QuestionTranslatedService;
import com.wuwei.elearning.utils.RecordUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

@Service
public class QuestionTranslatedServiceImpl extends ServiceImpl<QuestionTranslatedMapper, QuestionTranslated> implements QuestionTranslatedService {
    @Resource
    private QuestionTranslatedMapper questionTranslatedMapper;

    @Resource
    private RecordUtils recordUtils;

    @Override
    @Transactional
    public void myUpdate(QuestionTranslated questionTranslated, Long account) {
        QuestionTranslated questionTranslated1 = questionTranslatedMapper.selectById(questionTranslated.getId());
        recordUtils.recordQuestionTranslatedChange(questionTranslated1, questionTranslated, account);
        questionTranslatedMapper.updateById(questionTranslated);
    }
}
